package com.filldream.fastboot.base.request.pc.serverInfo;

import com.filldream.fastboot.common.util.Assert;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@Data
public class ModifyAppResourceSTO {

    private Long id;

    @NotNull
    @ApiModelProperty(value = "服务器ID")
    private Long serverId;

    @NotEmpty
    @ApiModelProperty(value = "基本路径")
    private String basePath;

    @NotNull
    private Integer basePort;

    @NotNull
    @ApiModelProperty(value = "状态 0-禁用 1-可用")
    private Integer status;

    @NotNull
    @ApiModelProperty(value = "部署操作，字典after_file_type，0-不做操作 1-压缩包解压即可 2-执行脚本")
    private Integer afterFileType;

    @ApiModelProperty(value = "脚本内容")
    private String shellTxt;

    @NotEmpty
    @ApiModelProperty(value = "备注用途")
    private String remark;

    public ModifyAppResourceSTO check(){
        if( afterFileType.equals(2) ){
            Assert.isEmpty( shellTxt,"脚本不能为空" );
        }
        return this;
    }

}
